﻿using System;
using System.Web;
using System.Web.Hosting;
using OpenWaves.ImageTransformations.Web;

namespace OpenWaves.ImageTransformations.Showcase
{
    public class Global : HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            var module = new WebImageTransformationModuleImplementation(
                new WebImageTransformationService(
                    new CompositeVirtualFileProvider(new VirtualPathFileProvider(HostingEnvironment.VirtualPathProvider), new WebFileProvider()), 
                    new ConcurrentFileStore(new MapPathBasedFileStore(UrlPath.Parse("~/Content/Images/Transformed"))), 
                    new GdiImageTransformationService()));

            ServiceLocator.SetResolver(new BasicResolver()
                .Register<IWebImageTransformationService>(module)
                .Register<IWebImageTransformationModuleImplementation>(module));
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}